home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / readers / utils / gui4cli / g4c / gm / wbdms.gc < prev    next >
Text File  |  1996-10-28  |  5KB  |  236 lines

  1. G4C
  2.  
  3. ; A GUI window for the DMS Disk Masher program
  4. ; By G. Maddox 21-Sep-96
  5.  
  6. ; Ah! I see you are reading the script... Very wise.
  7.  
  8.  
  9. WinBig -1 11 565 70 "Workbench DMS"
  10. WinSmall 200 0 240 -1
  11. WinType 01110001
  12. WinOut "con:0/96/640/160/DMS Output/AUTO CLOSE"
  13.  
  14. ; ------------------------- GRAPHICS -------------------------
  15.  
  16. BOX 0 0 0 0 IN ICONDROP
  17. BOX 12 8 90 57 IN BUTTON
  18. BOX 14 9 86 55 OUT BUTTON
  19. BOX 398 8 154 39 IN BUTTON
  20. BOX 400 9 150 37 OUT BUTTON
  21. CTEXT 30 11 " Drive " topaz.font 8 2 0 010
  22. CTEXT 432 11 " Operators " topaz.font 8 2 0 010
  23.  
  24. ; ---------------------- GENERAL EVENTS ----------------------
  25.  
  26. xOnLoad
  27. Extract WBDMS.gc GUIPATH wbdms_guipath
  28. Appvar wbdms_guipath "/WBDMS.gc"
  29. TTGet $wbdms_guipath
  30. Setvar .wbdms_dlist "DF0:\n"
  31. IfExists DEVICE DF1
  32.    Append env:.wbdms_dlist 'DF1:\n'
  33. Endif
  34. IfExists DEVICE DF2
  35.    Append env:.wbdms_dlist 'DF2:\n'
  36. Endif
  37. IfExists DEVICE DF3
  38.    Append env:.wbdms_dlist 'DF3:'
  39. Endif
  40. GuiOpen WBDMS.gc
  41. LVChange WBDMS.gc 3 env:.wbdms_dlist
  42. Update WBDMS.gc 4 $DRIVE
  43. Gosub WBDMS.gc updatelv
  44.  
  45. xOnQuit
  46. Delete env:.wbdms#?
  47. Delvar wbdms#?
  48.  
  49. xOnReturn 1
  50. Gosub WBDMS.gc gadon
  51.  
  52. xOnReturn 11
  53. Gosub WBDMS.gc gadon
  54. Gosub WBDMS.gc updatelv
  55.  
  56. ; --------------------------- THE GADGETS ----------------------
  57.  
  58. xBUTTON 358 50 32 15 "DIR"
  59. GadID 10
  60. ReqFile -1 -1 300 -40 "Change Directory" DIR FILEPATH SYS:
  61. Gosub WBDMS.gc updatelv
  62.  
  63. xLISTVIEW 110 5 280 48 "" wbdms_fname env:.wbdms_flist 0 TXT
  64. GadID 1
  65. Gosub WBDMS.gc joinvar
  66.  
  67. xTEXTIN 110 50 248 15 "" wbdms_fname "" 30
  68. GadID 2
  69. Gosub WBDMS.gc joinvar
  70.  
  71. xLISTVIEW 22 15 70 35 "" DRIVE env:.wbdms_dlist 0 TXT
  72. GadID 3
  73. Update WBDMS.gc 4 $DRIVE 
  74.  
  75. TEXT 22 48 70 12 $DRIVE 6 BOX
  76. GadTxt CENTER
  77. GadID 4
  78.  
  79. xBUTTON 408 29 65 12 "Test"
  80. GadID 5
  81. Gosub WBDMS.gc joinvar
  82. Gosub WBDMS.gc gadoff
  83. Gosub WBDMS.gc ifex
  84. LAUNCH 1 'c:DMS TEST "$wbdms_fname"'
  85.  
  86. xBUTTON 408 15 65 12 "Read"
  87. GadID 6
  88. Gosub WBDMS.gc joinvar
  89. Gosub WBDMS.gc gadoff
  90. IfExists FILE $wbdms_fname
  91.    Gosub WBDMS.gc owrite
  92.    LAUNCH 11 'c:DMS READ "$wbdms_fname" FROM $DRIVE'
  93. Else
  94.    Gosub WBDMS.gc read
  95.    LAUNCH 11 'c:DMS READ "$wbdms_fname" FROM $DRIVE'
  96. Endif
  97.  
  98. xBUTTON 477 15 65 12 "Write"
  99. GadID 7
  100. Gosub WBDMS.gc joinvar
  101. Gosub WBDMS.gc gadoff
  102. Gosub WBDMS.gc ifex
  103. EzReq "INSERT A DISK IN $DRIVE" "Okay|Cancel" opt
  104. If $opt = 1
  105.    LAUNCH 1 'c:DMS WRITE "$wbdms_fname" TO $DRIVE'
  106. Else
  107.    Gosub WBDMS.gc gadon
  108. Endif
  109.  
  110. xBUTTON 477 29 65 12 "View"
  111. GadID 8
  112. Gosub WBDMS.gc joinvar
  113. Gosub WBDMS.gc gadoff
  114. Gosub WBDMS.gc ifex
  115. LAUNCH 1 'c:DMS VIEW "$wbdms_fname"'
  116.  
  117. xBUTTON 445 52 60 12 "Quit"
  118. GadID 9
  119. GuiQuit WBDMS.gc
  120.  
  121. ; --------------------------- THE MENUS --------------------------
  122.  
  123. xMENU Project About... "" ""
  124. EzReq "Workbench DMS\n\nWriten by G.Maddox 21-9-96\n\nThis script is Freely\nDistributable. Do what you\nlike with it.\n\nCurrent Path:\n$FILEPATH\n" "Incredible!" opt
  125. Stop
  126.  
  127. ;  xMENU Project Help... "" ""
  128. ;  Not yet implemented
  129.  
  130. xMENU Project "Delete File..." "" ""
  131. Gosub WBDMS.gc joinvar
  132. IfExists FILE $wbdms_fname
  133.    Gosub WBDMS.gc delete
  134.    Stop
  135. Else
  136.    EzReq "$wbdms_fname DOES NOT EXIST." "Whoops!" opt
  137.    Stop
  138. Endif
  139.  
  140. xMENU Project BARLABEL "" ""
  141.  
  142. xMENU Project Quit... "" ""
  143. GuiQuit WBDMS.gc
  144.  
  145. ; ---------------------------- ROUTINES ------------------------
  146.  
  147. xRoutine joinvar
  148. CutVar wbdms_fname COPY CHAR -4 wbdms_end
  149. DoCase $wbdms_end
  150.    Case = ".dms"
  151.       CutVar wbdms_fname CUT CHAR -4 wbdms_end 
  152.       SetVar wbdms_end ".DMS"
  153.       AppVar wbdms_fname '$wbdms_end'
  154. BREAK
  155.    Case != ".DMS"
  156.       SetVar wbdms_end ".DMS"
  157.       AppVar wbdms_fname '$wbdms_end'
  158. BREAK
  159. EndCase
  160. Update WBDMS.gc 2 $wbdms_fname
  161. Return
  162.  
  163. xRoutine gadoff
  164. SetGad WBDMS.gc 1 OFF
  165. SetGad WBDMS.gc 2 OFF
  166. SetGad WBDMS.gc 3 OFF
  167. SetGad WBDMS.gc 5 OFF
  168. SetGad WBDMS.gc 6 OFF
  169. SetGad WBDMS.gc 7 OFF
  170. SetGad WBDMS.gc 8 OFF
  171. SetGad WBDMS.gc 9 OFF
  172. SetGad WBDMS.gc 10 OFF
  173. Return
  174.  
  175. xRoutine gadon
  176. SetGad WBDMS.gc 1 ON
  177. SetGad WBDMS.gc 2 ON
  178. SetGad WBDMS.gc 3 ON
  179. SetGad WBDMS.gc 5 ON
  180. SetGad WBDMS.gc 6 ON
  181. SetGad WBDMS.gc 7 ON
  182. SetGad WBDMS.gc 8 ON
  183. SetGad WBDMS.gc 9 ON
  184. SetGad WBDMS.gc 10 ON
  185. Return
  186.  
  187. xRoutine ifex
  188. IfExists FILE $wbdms_fname
  189.    Return
  190. Else
  191.    EzReq "$wbdms_fname DOES NOT EXIST." "Whoops!" opt
  192.    Gosub WBDMS.gc gadon
  193.    Stop
  194. Endif
  195. Return
  196.  
  197. xRoutine owrite
  198. EzReq "********* WARNING! *********\n$wbdms_fname\nALREADY EXISTS. IF YOU WISH\n   TO OVERWRITE IT, THEN\nINSERT A DISK IN $DRIVE NOW." "Overwrite|Cancel" opt
  199. If $opt = 1
  200.    Return
  201. Else
  202.    Gosub WBDMS.gc gadon
  203.    Stop
  204. Endif
  205. Return
  206.  
  207. xRoutine read
  208. EzReq "INSERT A DISK IN $DRIVE" "Okay|Cancel" opt
  209. If $opt = 1
  210.   Return
  211. Else
  212.    Gosub WBDMS.gc gadon
  213.    Stop
  214. Endif
  215. Return
  216.  
  217. xRoutine updatelv
  218. CD $FILEPATH
  219. CLI 'c:List >env:.wbdms_flist $FILEPATH lformat "%s"'
  220. LVChange WBDMS.gc 1 env:.wbdms_flist
  221. LVSort WBDMS.gc 1
  222. Return
  223.  
  224. xRoutine delete
  225. EzReq "********* WARNING! *********\nYOU CANNOT GET BACK DELETED\n   FILES! ARE YOU SURE?\n\nDELETE $wbdms_fname ?" "Delete|Abort" opt
  226. If $opt = 1
  227.    Delete "$wbdms_fname"
  228.    SetVar wbdms_fname ""
  229.    Gosub WBDMS.gc updatelv
  230.    Update WBDMS.gc 2 $wbdms_fname
  231. Else
  232.    Stop
  233. Endif
  234. Return
  235.  
  236.